package com.dave.admin.common.exception;

import org.springframework.util.Assert;


public abstract class AssertionEx extends Assert {

    public static void isTrue(boolean expression, String message) {
        if (!expression) {
            throw new AssertionException(message);
        }
    }

    public static void isFalse(boolean expression, String message) {
        if (expression) {
            throw new AssertionException(message);
        }
    }


    public static void state(boolean expression, String message) {
        if (!expression) {
            throw new AssertionException(message);
        }
    }


    public static void isNull(Object object, String message) {
        if (object != null) {
            throw new AssertionException(message);
        }
    }


    public static void notNull(Object object, String message) {
        if (object == null) {
            throw new AssertionException(message);
        }
    }

}
